﻿<%@ page contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<head>
<title>看点列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<%=request.getContextPath()%>/style/adminStyle.css" rel="stylesheet" type="text/css" />
<script src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script src="<%=request.getContextPath()%>/js/public.js"></script>
<script type="text/javascript">
function selec() {
	var sr=${admin.jurisdiction};
	 if(sr==1){
		 alert("权限不足");
		return false;
	 }else{
		 return true;
	 }
}
function dele(){
	var sr=${admin.jurisdiction};
	if(sr==1){
		 alert("权限不足");
		return false;
	 }else{
		 return true;
	 }
	
	
}

function temps(){
	var i=1;
if(Form.id.value==""|Form.id.value==null){
	
	 i=0;
}
if(i==0){
	 alert("条件不能为空");
	 Form.id.focus();
	 return false;
}else{
	if(Form.id.value.length>10){
		alert("查询条件不正确");
		 return false;
	}

	if(/.*[\u4e00-\u9fa5]+.*$/.test(Form.id.value)){ 
		alert("不能含有汉字！"); 
		return false; 
		} 
	return true;
}
	

}
</script>
</head>
<body>
 <div class="wrap">
  <div class="page-title">
    <span class="modular fl"><i></i><em>看点列表</em></span>
    <span class="modular fr"><a href="<%=request.getContextPath()%>/Administrators/advertising.do" class="pt-link-btn" onclick="return selec()">+添加看点</a></span>
  </div>
  
   <div class="operate">
   <form action="../Administrators/advertising_list2.do" name="Form" onclick="return temps()">
    <select class="inline-select" id="fir">
     <option value="id">ID</option>
     
    </select>
    <input type="text" class="textBox length-long" placeholder="输入查询ID..." name="id" id="id"/>
    <input type="submit" value="查询" class="tdBtn" />
   </form>
  </div>
  
  <table class="list-style Interlaced">
   <tr>
    <th>id</th>
    <th>图片</th>
    <th>一级分类</th>
    <th>二级分类</th>
    <th>标题</th>
    <th>创建时间</th>
    <th>浏览数</th>
    <th>操作</th>
   </tr>
      <c:if test="${news!=null}">
   <tr>
   	<td align="center">${news.id}</td>
   	<td align="center">${news.url1}</td>
   	<td align="center">${news.firstclass}</td>
   	<td align="center">${news.towclass}</td>
    <td align="center">${news.title}</td>
    <td align="center">${fn:substring(news.creationtime, 0, 19)}</td>
    <td align="center">${news.browsenumber}</td>
    <td class="center">
     <a href="../Administrators/advertising2.do?id=${news.id}" title="编辑" onclick="return dele();"><img src="<%=request.getContextPath()%>/images/icon_edit.gif" /></a>
     <a title="删除"  onclick="del(${news.id});"><img src="<%=request.getContextPath()%>/images/icon_drop.gif"/></a>
    </td>
   </tr>
   </c:if>
  </table>
  <!-- BatchOperation -->
  <div style="overflow:hidden;">
      <!-- Operation -->
	<!--   <div class="BatchOperation fl">
	   <input type="checkbox" id="del"/>
	   <label for="del" class="btnStyle middle">全选</label>
	   <input type="button" value="批量删除" class="btnStyle"/>
	  </div> -->
	  <!-- turn page -->
	  <div class="turnPage center fr">
	   <a>上一页</a>
	   <a>当前：第1页,共1页</a>
	   <a >下一页</a>
	  </div>
  </div>
 </div>
<script type="text/javascript">



function del(id) {
	var msg = "您确定要删除吗？\n\n请确认！";
	var sr=${admin.jurisdiction};
	
	if (confirm(msg)==true){
		if(sr==1){
			  alert("权限不足");
		}else{
			$.ajax({
				"url":"${pageContext.request.contextPath}/Administrators/news_delete.do",
				"data":"id="+id,
				"type":"POST",
				"dataType":"json",
				"success":function(obj){

					if(obj.state==1){
						
						window.location="${pageContext.request.contextPath}/Administrators/advertising_list.do";
						
					}
			
				}});
		}
	}
	}

</script>
</body>
</html>